Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes multi-actor conflict tests deterministic in the “matching timestamp / version tie” case by adding test hooks to force Hybrid Logical Clock (HLC) timestamps to align across peers, and by codifying expected tie-breaking behavior across replication modes (XDCR, Couchbase Lite mock, ISGR/SGR).
Changes:
- Added multi-actor conflict test dimensions to explicitly exercise “ClockTie” scenarios by forcing HLC clocks to a fixed value.
- Updated the Couchbase Lite BLIP test client’s LWW conflict resolution to prefer the incoming (remote) revision on version ties.
- Added explicit matching-timestamp regression tests for XDCR and Active Replicator (SGR) conflict resolution, plus small test-only HLC clock override hooks.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| xdcr/xdcr_test.go | Adds an XDCR regression test for “matching timestamp” tie handling (target/local wins). |
| topologytest/multi_actor_conflict_test.go | Adds a ClockTie subtest dimension to multi-actor conflict tests (create/update/delete/resurrect). |
| topologytest/multi_actor_conflict_clock_tie_test.go | Introduces helper utilities to force HLC clock ties across controllable peers (and rosmar when applicable). |
| rest/utilities_testing_blip_client.go | Makes BLIP tester LWW conflict resolution prefer remote on ties; adds a test hook to override the client HLC clock. |
| rest/replicatortest/replicator_test.go | Adds an Active Replicator (SGR) matching-timestamp tie test asserting local wins with default resolver. |
| db/utilities_hlv_testing.go | Adds a DatabaseContext test hook to override the HLC clock function for deterministic HLV generation. |
| go.mod | Updates sg-bucket and rosmar dependency versions to support clock-for-test functionality. |
| go.sum | Updates dependency checksums corresponding to go.mod changes. |
If sourceIDs are different but version element is exaclty the same, the topologytest would fail with unexpected revisions. Implement tests with existing behavior: - XDCR: local wins - CBL: remote wins - ISGR: local wins Add some hooks to force the ability to set the clock for these tests so that this behavior doesn't regress.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CBG-5547 handle topologytest conflicts for matching timestamps
If sourceIDs are different but version element is exaclty the same, the topologytest would fail with unexpected revisions.
Implement tests with existing behavior:
Add some hooks to force the ability to set the clock for these tests so that this behavior doesn't regress.
I appreciate thoughts on:
In this PR, I don't address whether we want the ISGR resolution to match CBL, the tests are present so we can use them if behavior changes. The XDCR test does run against Couchbase Server so we can see if their behavior is modified. This is so unlikely to happen outside of a CI environment, especially one that isn't using rosmar and a lite memory mock that I don't think it is worth fixing.
Pre-review checklist
fmt.Print,log.Print, ...)base.UD(docID),base.MD(dbName))docs/apiIntegration Tests